using Microsoft.AspNetCore.Mvc;
using zhwy.saas.api.Entity.Sys;
using zhwy.saas.api.Models;
using zhwy.saas.api.Services.Sinterface.Sys;

namespace zhwy.saas.api.Controllers.V1.Sys
{
    /// <summary>
    /// 系统菜单管理
    /// </summary>
    [ApiVersion("1.0")]
    public class SysMenuController : BaseController<MenusEntity>
    {
        private readonly ISysMenuService _sysMenuService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="sysMenuService">菜单服务</param>
        public SysMenuController(ISysMenuService sysMenuService)
            : base(sysMenuService)
        {
            _sysMenuService = sysMenuService;
        }

        ///// <summary>
        ///// 获取菜单树
        ///// </summary>
        ///// <returns>菜单树形结构</returns>
        ///// <response code="200">成功获取菜单树</response>
        //[HttpGet("tree")]
        //[ProducesResponseType(typeof(ApiResponse<List<MenusEntity>>), 200)]
        //public async Task<ActionResult<ApiResponse<List<MenusEntity>>>> GetMenuTree()
        //{
        //    var menuTree = await _sysMenuService.GetMenuTreeAsync();
        //    return ApiResponse<List<MenusEntity>>.Ok(menuTree);
        //}

        ///// <summary>
        ///// 获取用户菜单权限
        ///// </summary>
        ///// <param name="userId">用户ID</param>
        ///// <returns>用户菜单列表</returns>
        ///// <response code="200">成功获取用户菜单</response>
        //[HttpGet("user/{userId}")]
        //[ProducesResponseType(typeof(ApiResponse<List<MenusEntity>>), 200)]
        //public async Task<ActionResult<ApiResponse<List<MenusEntity>>>> GetUserMenus(long userId)
        //{
        //    var menus = await _sysMenuService.GetUserMenusAsync(userId);
        //    return ApiResponse<List<MenusEntity>>.Ok(menus);
        //}

        ///// <summary>
        ///// 获取角色菜单权限
        ///// </summary>
        ///// <param name="roleId">角色ID</param>
        ///// <returns>角色菜单列表</returns>
        ///// <response code="200">成功获取角色菜单</response>
        //[HttpGet("role/{roleId}")]
        //[ProducesResponseType(typeof(ApiResponse<List<MenusEntity>>), 200)]
        //public async Task<ActionResult<ApiResponse<List<MenusEntity>>>> GetRoleMenus(long roleId)
        //{
        //    var menus = await _sysMenuService.GetRoleMenusAsync(roleId);
        //    return ApiResponse<List<MenusEntity>>.Ok(menus);
        //}

        ///// <summary>
        ///// 更新菜单状态
        ///// </summary>
        ///// <param name="id">菜单ID</param>
        ///// <param name="status">新状态</param>
        ///// <returns>更新结果</returns>
        ///// <response code="200">状态更新成功</response>
        ///// <response code="400">状态更新失败</response>
        //[HttpPut("{id}/status")]
        //[ProducesResponseType(typeof(ApiResponse<bool>), 200)]
        //[ProducesResponseType(typeof(ApiResponse<bool>), 400)]
        //public async Task<ActionResult<ApiResponse<bool>>> UpdateStatus(long id, [FromBody] int status)
        //{
        //    var result = await _sysMenuService.UpdateStatusAsync(id, status);
        //    return result
        //        ? ApiResponse<bool>.Ok(true, "状态更新成功")
        //        : ApiResponse<bool>.Error("状态更新失败");
        //}
    }
}